class MinStack {
public:
    stack<int> stk;
    stack<int> minstk;
    
    MinStack() {
    while(!stk.empty()){
        stk.pop();
    }
    while(!minstk.empty()){
        minstk.pop();
    }
    minstk.push(INT_MAX);
    }
    
    void push(int val) {
    stk.push(val);
     int minnum=std::min(minstk.top(),val);
     minstk.push(minnum);
    }
    
    void pop() {
    stk.pop();
    minstk.pop();
    }
    
    int top() {
    return stk.top();
    }
    
    int getMin() {
   return minstk.top();
    }
};

/**
 * Your MinStack object will be instantiated and called as such:
 * MinStack* obj = new MinStack();
 * obj->push(val);
 * obj->pop();
 * int param_3 = obj->top();
 * int param_4 = obj->getMin();
 */
